<dialog class="dialog" data-dialog-target="dialog" id="stock_transfer_dialog" data-controller="search-picker">
  <%= dialog_header(Spree.t(:add_variant)) %>
  <div class="dialog-body">
    <%= form_with url: spree.admin_variants_search_path, method: :post, data: { controller: 'auto-submit', turbo_frame: '_top' } do |form| %>
      <%= form.search_field :q, value: params[:q], class: 'form-control', data: { search_picker_target: :search, action: 'auto-submit#submit' }, autofocus: true %>
      <%= form.hidden_field :param_name, value: 'stock_transfer' %>
      <%= form.hidden_field :all, value: true %>
      <%= form.hidden_field :eligible, value: true %>
      <%= form.hidden_field :omit_ids, value: @variant_omit_ids&.join(',').presence, data: { stock_transfer_target: :newVariantOmitIds } %>
      <%= form.hidden_field :stock_location_id, value: params.dig(:stock_transfer, :source_location_id), data: { stock_transfer_target: :newVariantStockLocationId } %>
    <% end %>
  </div>
  <div class="dialog-body">
    <div id="variants_search_results" class="search-results" data-search-picker-target="results">
      <p class="text-muted text-center py-5">
        <%= Spree.t(:start_typing_to_search_for_variants) %>
      </p>
    </div>
  </div>
  <div class="dialog-footer">
    <%= dialog_discard_button %>
    <%= button_tag Spree.t(:add_selected_variant), class: "btn btn-primary text-center", disabled: true, data: { search_picker_target: :submit, action: 'stock-transfer#add search-picker#closeAndClear dialog#close' } %>
  </div>
</dialog>
